<!--
 * @Description:
 * @Author: dh
 * @Date: 2021-08-19 17:18:39
 * @LastEditors: dh
 * @LastEditTime: 2022-04-12 16:20:25
-->
<!doctype html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
	</head>

	<body>
		<div>父</div>
		<iframe src="./2 son.html" frameborder="0"></iframe>
		<script>
			console.log('%c parent- window.document', 'color:teal', window.document); // 当前页
			console.log('%c parent- window.parent.document', 'color:teal', window.parent.document); // 当前页
			console.log('%c parent- window.top.document', 'color:teal', window.top.document); // 当前页

			function fn(who) {
				console.log('%c' + who + '调用了 parent 方法', 'font-weight:800;color:teal');
			}
		</script>
	</body>
</html>
